# -*- coding: utf-8 -*-
# @Time : 2019/1/10 16:35
# @Author : Administrator
# @File : boss_login.py
# @Project : code
# @title : woniuboss登录
import requests
class TestLogin():
    def test001(self):  #正确的用户名、用户密码、验证码，登录成功
        data_login={"userName":"wncd000","userPass":"woniu123","checkcode":"0000"}
        r=requests.post(url="http://192.168.230.3:8080/WoniuBoss2.5/log/userLogin",
                        data=data_login)
        print(r.text)
        assert r.text == "success"

    def test002(self):  #用户名输入不存在的用户名，登录失败
        data_login={"userName":"wn000","userPass":"woniu123","checkcode":"0000"}
        r=requests.post(url="http://192.168.230.3:8080/WoniuBoss2.5/log/userLogin",
                        data=data_login)
        print(r.text)
        assert r.text == "error"

    def test003(self):  #用户名输入为空，登录失败
        data_login={"userName":"","userPass":"woniu123","checkcode":"0000"}
        r=requests.post(url="http://192.168.230.3:8080/WoniuBoss2.5/log/userLogin",
                        data=data_login)
        print(r.text)
        assert  "用户名不能为空." in r.text

    def test004(self):  #验证码输入为空，登录失败
        data_login={"userName":"wncd000","userPass":"woniu123","checkcode":""}
        r=requests.post(url="http://192.168.230.3:8080/WoniuBoss2.5/log/userLogin",
                        data=data_login)
        print(r.text)
        assert r.text == "checkcodeError"

if __name__ == '__main__':
    t=TestLogin()
    t.test001()
    t.test002()
    t.test003()
    t.test004()